/**
 * 
 */
package cn.edu.cqu.bysj.wm.keynode;

import java.util.List;

import org.neo4j.graphdb.Node;

import cn.edu.cqu.bysj.wm.ago.lp.LP;


/**
 * @author Meng
 * 
 */
class FaginRunnable implements Runnable {
	LP lp;
	CentralityTool cTool;
	Fagin fagin = new Fagin();
	long cid;
	int k;
	double clusterLimit;

	/**
	 * @param cTool
	 */
	public FaginRunnable(LP lp, long cid, int k, List<Node> list, int[] flag) {
		super();
		this.lp = lp;
		this.cid = cid;
		this.k = k;
		this.cTool = new CentralityTool(lp, flag, list);
		this.clusterLimit = 0;
	}

	@Override
	public void run() {
		cTool.ssspDijsktra();
		cTool.getDiameter();
		cTool.degreeCentrality();
		cTool.betweennessCentrality();
		cTool.stressCentrality();
		cTool.clossnessCentrality();
		cTool.clusterCoefficient(clusterLimit);
		cTool.pagerank(lp.matrix);
		cTool.rankAll();
		fagin.FA(cTool, k);
		KeyNodes.fLocalKeyNodes.put(cid, fagin.keyNodes);
	}

}